package com.ruoyi.logistic.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.logistic.domain.NetworkSubjectDisposition;
import com.ruoyi.logistic.domain.NetworkSubjectFirst;
import com.ruoyi.logistic.domain.PageDate;
import com.ruoyi.logistic.domain.vo.NetworkSubjectDispositionSearchVo;
import com.ruoyi.logistic.mapper.NetworkSubjectDispositionMapper;
import com.ruoyi.logistic.mapper.NetworkSubjectFirstMapper;
import com.ruoyi.logistic.service.INetworkSubjectDispositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;
@Service
public class NetworkSubjectDispositionServiceImpl implements INetworkSubjectDispositionService {
    @Autowired
    private NetworkSubjectDispositionMapper networkSubjectDispositionMapper;
    @Autowired
    private NetworkSubjectFirstMapper networkSubjectFirstMapper;
    @Override
    public List<NetworkSubjectDisposition> selectAll(PageDate pageDate) {
        PageHelper.startPage(pageDate);
        return networkSubjectDispositionMapper.selectAll();
    }
    @Override
    public Boolean insert(NetworkSubjectDisposition networkSubjectDisposition) {
        networkSubjectDisposition.setCreateBy(SecurityUtils.getUserId());
        return networkSubjectDispositionMapper.insert(networkSubjectDisposition);
    }

    @Override
    public Boolean update(NetworkSubjectDisposition networkSubjectDisposition) {
        return networkSubjectDispositionMapper.update(networkSubjectDisposition);
    }

    @Override
    public Boolean deleteById(Integer id) {
        return networkSubjectDispositionMapper.deleteById(id);
    }

    @Override
    public NetworkSubjectDisposition findById(Integer id) {
        return networkSubjectDispositionMapper.findById(id);
    }

    @Override
    public List<NetworkSubjectDisposition> search(NetworkSubjectDispositionSearchVo networkSubjectDispositionSearchVo) {
        PageHelper.startPage(networkSubjectDispositionSearchVo.getPageDate());
        return networkSubjectDispositionMapper.search(networkSubjectDispositionSearchVo);
    }


    @Override
    public List<NetworkSubjectFirst> selectSubjectFirstAll() {
        return networkSubjectFirstMapper.selectAll();
    }
}
